import { JSEncrypt } from 'jsencrypt'
export default function jsencrypt(data) {
    const encryptor = new JSEncrypt()
    const publicKey =
        `-----BEGIN PUBLIC KEY-----
  MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCs+s4mRTS8FQQo3z5ImgEDZ0xD
  OjqWGOJJAwwBK+P/BKbvoOiBBvnE2yGD5FN398zh7xS1QNQDGXpUS/qTpA6WLYDJ
  r3/rMINRQGr5P5OnypYnJbJwzVgHQDf3sMH5me9LsO+Z1ZuEQT8mvA98vCQ6+z9a
  Ac1e4RxMG+A2+266qQIDAQAB
  -----END PUBLIC KEY-----
  `

    // 设置公钥
    encryptor.setPublicKey(publicKey)// publicKey为公钥
    return encryptor.encrypt(data)// data就是需要加密的数据
}
